<?

if ($DATA['component']['id']) {
	
	$_record = array('id_data' => D_MB_SETTINGS, 'id_parent' => $DATA['component']['id']);
	$_defaults = array('id' => 'panel', 'obj' => 'xPanel', 'activator' => '#showPanel');

	switch (action(array('editor_save'))) {
	
		case 'editor_save':

			$temp = array();
			
			foreach($_defaults as $k => $v)
				if ($t = trim(postdata($k)))
					$temp[] = array_merge($_record, array('name' => $k, 'value' => postdata($k)));

			dataset('db_delete', tb('data'), "(id_data=".D_MB_SETTINGS.") AND (id_parent={$DATA[component][id]})");
			dataset('db_insert', tb('data'), $temp);
			
			return true;	// end of component edition
	}
	
	$DATA['settings'] = array_merge( $_defaults, datafetch_array('meta', D_MB_SETTINGS, $DATA['component']['id']));
		
	return false;

} else exit;

?>